<%@page import="java.util.List"%>
<%@page import="domain.model.user.User"%>

<h2> Invite Users</h2>
<br/>
<div>${msg}</div>
		
<div id="queryContents">

<table id="inviteTable" style="border-collapse: collapse;">
	
	<%
		List<User> users = (List<User>)request.getAttribute("userList");
	
		if(users.isEmpty())
		{
			%>
				<p>There are no users to invite.<br/> (oops! everybody is taken at the moment)</p>
			<%
			
		}
		else
		{
			
	%>
			<tr>
				<th>Name</th>
				<th>&nbsp;</th>
			</tr>
	<%
				
			for(User user: users)
			{
	%>
		
			<tr>
				<td><%=user.getFirstName()%> <%=user.getLastName()%></td>
				<td id="btn_<%=user.getId()%>">
				
				<!--  
				<form method="POST" action="">
					<input type="hidden" value="<%=user.getId()%>" name="userId" />
					<input type="hidden" value="${groupId}" name="groupId" />
					<input type="hidden" value="<%=user.getVersion()%>"  name="userversionForInvitation"/>
					<input type="submit" value="Invite"/>
				</form>
				-->
				<a href="#" class="button1" onclick="inviteUser(<%=user.getId()%>,<%=user.getVersion()%>);">invite</a>
				</td>
			</tr>
		
	<%
			}
		}
	%>
</table>
</div> <!--closing queryContents -->
